package TestCases;

//Importing class for WebDriver
import java.io.IOException;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.events.EventFiringWebDriver;

//Importing class for PageObjectFactory
import org.openqa.selenium.support.PageFactory;

//Importing class for TestNGclass
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;



//Importing Functional Library classes
import FunctionalLibrary.webdriverListner;
import FunctionalLibrary.customReporter;
import FunctionalLibrary.excelFunctions;

//Importing Individual Page Object Factory classes
import PageOR.BookAFlight;
import PageOR.FindAFlight;
import PageOR.FlightConfirmation;
import PageOR.SelectAFlight;
import PageOR.WelcomeMercuryTours;

@Listeners(customReporter.class)
public class SetUp 
{
	
	//Declaring Object for WebDriver
	public WebDriver browserdriver;
	
	//Declaring Object for Web Driver Listeners
	public EventFiringWebDriver driver;
	public webdriverListner objWebDriverListner;
	
	
	//Page Object factory Objects for Individual Pages
	public WelcomeMercuryTours objWelcomeMercuryPage;
	public FindAFlight objFindFlightPage;
	public SelectAFlight objSelectAFlightPage;
	public BookAFlight objBookAFlightPage;
	public FlightConfirmation objFlightConfirmationPage;
	public String strBaseURL;
	
	//Declaring Object for Excel Class
	public excelFunctions objExcellib;
	//@BeforeMethod
	public  void setup() throws Exception
	{
		objExcellib= new excelFunctions();
		System.out.println(objExcellib.excel_GetRowCount("F:\\", "Miami Expense.xlsx", "Sharing"));
		System.out.println(objExcellib.excel_GetColumnCount("F:\\", "Miami Expense.xlsx", "Sharing"));
		System.out.println(objExcellib.excel_GetCellData("F:\\", "Miami Expense.xlsx", "Sharing", 2, 2));
		
		System.out.println(objExcellib.excel_GetRowCount("F:\\", "Miami Expense.xls", "Sharing"));
		System.out.println(objExcellib.excel_GetColumnCount("F:\\", "Miami Expense.xls", "Sharing"));
		System.out.println(objExcellib.excel_GetCellData("F:\\", "Miami Expense.xls", "Sharing", 2, 2));
		
	}
	//@Test
	public  void initialization1()
	{
		
	}
	@BeforeMethod
	public  void initialization()
	{
		browserdriver = new FirefoxDriver();
		driver  = new EventFiringWebDriver(browserdriver);
		objWebDriverListner = new webdriverListner();
		driver.register(objWebDriverListner);
		objWelcomeMercuryPage= PageFactory.initElements(driver, PageOR.WelcomeMercuryTours.class);
		objFindFlightPage= PageFactory.initElements(driver, PageOR.FindAFlight.class);
		objSelectAFlightPage = PageFactory.initElements(driver, PageOR.SelectAFlight.class);
		objBookAFlightPage = PageFactory.initElements(driver, PageOR.BookAFlight.class);
		objFlightConfirmationPage= PageFactory.initElements(driver, PageOR.FlightConfirmation.class);
		driver.manage().window().maximize();
	}
	
	@AfterMethod
	public void Cleanup()
	{
		driver.close();
	}
}
